package J19;

import java.util.Scanner;

import rmaqlc31.model.SungJukVO;
import rmaqlc31.service.JDBCSungJuk;

public class J19_Q_CdMain {

	private static final String title = "JDBC을 이용한 성적프로그램";
	private static final String menu = ">>>> 추가(1)  조회 (2)   종료 (0)";
	private static final String addmsg = "cd_id,제목,소속사,가수,가격 순으로 입력하세요";
	private static String exitmsg = "프로그램을 종료 합니다.";
	
	public static void main(String[] args) {
		J19_Q_Cd cdsrv = new J19_Q_Cd();
		Scanner sc = new Scanner(System.in);
		
		while(true){
			System.out.println(title);
			System.out.println(menu);
			switch (sc.nextInt()) {
			case 0: sc.close();	System.exit(0)
				;break;
			case 1:	addCd(sc, cdsrv);
					break;
			case 2:	showCd(cdsrv);
					break;
			default:
				break;
			}
	}

}


		public static void showCd(J19_Q_Cd cdsrv){
			System.out.println(cdsrv.readCd());
	}


	private static void addCd(Scanner sc, J19_Q_Cd cdsrv) {
		System.out.println(addmsg);
		
		J19_Q_CdVO cd = new J19_Q_CdVO(sc.next(), sc.next(), sc.next(), sc.next(), sc.nextInt());

		// 입력받은 데이터를 배열에 저장
		cdsrv.newCd(cd);		
	}
}